package com.ruipengkj.component;

import java.awt.Component;
import java.awt.FlowLayout;

import javax.swing.JPanel;

public class JPanelFlowLayoutComponent extends JPanel {

	private static final long serialVersionUID = 1L;
	
	/**
	 * 将一个组件放在FlowLayout的面板上，参数1：组件，参数2：对齐方式
	 */
	public JPanelFlowLayoutComponent(Component comp, int align) {
		super(new FlowLayout(align));
		this.setOpaque(false);
		this.add(comp);
	}
	/**
	 * 将多个组件放在FlowLayout的面板上，参数1：多个组件组成的数组，参数2：对齐方式
	 */
	public JPanelFlowLayoutComponent(Component[] comp, int align) {
		super(new FlowLayout(align));
		this.setOpaque(false);
		int length = comp.length;
		for(int i = 0; i < length; ++i) {
			this.add(comp[i]);
		}
	}
}
